[ ]:
import numpy as np
Q2: Planetary positions
The distances of the planets from the Sun (technically, their semi-major axes) are:
[ ]:
a = np.array([0.39, 0.72, 1.00, 1.52, 5.20, 9.54, 19.22, 30.06, 39.48])
These are in units where the Earth-Sun distance is 1 (astronomical units).
The corresponding periods of their orbits (how long they take to go once around the Sun) are, in years
[ ]:
P = np.array([0.24, 0.62, 1.00, 1.88, 11.86, 29.46, 84.01, 164.8, 248.09])
Finally, the names of the planets corresponding to these are:
[ ]:
names = ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn",
"Uranus", "Neptune", "Pluto"]
(technically, pluto isn’t a planet anymore, but we still love it :)
Plot as points, the periods vs. distances for each planet on a log-log plot.
Write the name of the planet next to the point for that planet on the plot
[3]:
from BicoccaCoursePython2024.terza_lezione import figure
fig=figure()
fig.show_planets_orbits()
Q8: Game of Life visualization
If you’ve implemented Conway’s Game of Life from last lecture, make a visualization of your result using matplotlib
[4]:
from IPython.display import HTML
ani=fig.animate_Game_of_life()
vid=HTML(ani.to_jshtml())
[5]:
vid
[5]: